﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FileToVideo.Class
{
    /// <summary>
    /// 键值对应颜色
    /// </summary>
    public class KeyColor
    {
        /// <summary>
        /// 键值
        /// </summary>
        public char Key { get; set; } = 'A'; // 或者 '\x00'

        /// <summary>
        /// 颜色(默认不使用Alpha通道)
        /// </summary>
        public string Color { get; set; } = "#FFFFFF";

        /// <summary>
        /// 从字典中读取列表
        /// </summary>
        /// <param name="dict"></param>
        /// <returns></returns>
        public List<KeyColor> FromDict(Dictionary<string,string> dict)
        {
            var ret = new List<KeyColor>();
            foreach (var item in dict)
            {
                KeyColor temp = new KeyColor();
                temp.Key = char.Parse(item.Key);
                temp.Color = item.Value;
                ret.Add(temp);
            }
            return ret;
        }
    }
}
